Appleworks Spreadsheet column width macro
By Rod Young
Copyright (c) 1990 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.
If you use the spreadsheet module of Appleworks anything more than occasionally, you will very quickly find that you have to make a lot of adjustments to the column widths.
It's usually at the beginning of your template, when you're trying to get all the labels at the top of the screen to fit in properly. Only thing is, it's a fairly slow process the standard Appleworks way. These are the keys you have to press:
"Apple-L" to change layout, "C" for columns, "rtn" to accept, "C" for column width, "apple-right/left" to make wider or narrower and "rtn" to accept. At least six key presses.
Standard Appleworks doesn't give you any indication of the actual width in characters of your column either. To do this, you would have to do a visual from the screen. Also laborious.
TimeOut Ultramacros version 3, the powerful Appleworks macro add-on, has the answers to these inconveniences.
The macros beneath allow you to cut out all the key presses and get an indication of column width.
To find out the width of a column, press "apple-W" (W for width), and you get a message at the bottom of the screen. After any key press, the message is cancelled - it would be annoying for it to stay there if you moved to a different column.
To adjust the width of a column, press "apple-control-W". You will be shown the current width and prompted to type in the desired width, greater or smaller. If "esc" is pressed, or the existing width entered, the macro is aborted. Otherwise, the column is widened or made narrower, with a running count of the width being displayed on the message bar. Finally, the message is extinguished after any keypress.
The macros are reproduced twice. The first version has curly brackets to explain each step and the second version has these stripped out. Copy in exactly and compile the second version, then enjoy the convenience.
------------------------------------------------------------ -----------------
start
<ctrl-W>:<asp Y = peek #ccwidth : {read column width into Y}
msg ' Current column width = ' + str$ Y + '. Type desired width of column in characters. ' : {message at bottom of screen}
$1 = getstr 2 : {enter 2-character string at bottom}
{of screen, read into $1}
X = val $1 : {X becomes numerical value of $1}
if X = 0 then msg "" : stop : {abort macro, clear message if ESC}
{or non-number entered}
else if X = Y then msg "" : stop :
{abort macro, clear message if}
{width is actual width}
else if X > Y then ba-> {execute macro to make column wider}
else if X < Y then ba-<>! {execute macro to make narrower}
Use this macro to adjust column width.
------------------------------------------------------------ -----------------
W:<asp ba-W : {call ba-W (prints message)}
X = key : print chr$ X : msg "">!{clears message after any keypress}
Displays the current column width and cancels message.
------------------------------------------------------------ -----------------
<ba-W>:<asp Y = peek #ccwidth : {read column width into Y}
msg ' Column width = ' + str$ Y + '. '>!
{message}
Displays current column width only. Called by sa-W
------------------------------------------------------------ -----------------
<ba->>:<asp msg "" : {clear message}
begin : {start loop}
oa-L>C<rtn>C<oa-right : rtn : {widen column by one character}
Y = peek #ccwidth : ba-W : if X = Y then sa-W : rtn stop else rpt>!
<ba-<>:<asp msg "" : begin : oa-L>C<rtn>C<oa-left : rtn : Y = peek #ccwidth : ba-W : if X = Y then sa-W : rtn stop else rpt>!
These macros are called by sa-ctrl-W and are not used by themselves, because they never stop. They do the actual widening and narrowing of columns.
------------------------------------------------------------ -----------------
start
<ctrl-W>:<asp><Y = peek #ccwidth : msg ' Current column width = ' + str$ Y + '. Type desired width of column in characters. ' : $1 = getstr 2 : X = val $1 : if X = 0 then msg "" : stop : else : if X = Y then msg "" : stop : else : if X > Y then ba-> : else : if X < Y then ba-<>!
W:<asp><ba-W : X = key : print chr$ X : msg "">!
<ba-W>:<asp><Y = peek #ccwidth : msg ' Column width = ' + str$ Y + '. '>!
<ba->>:<asp><msg "" : begin : oa-L>C<rtn>C<oa-right rtn Y = peek 177 : ba-W : if X = Y then sa-W : rtn stop : else : rpt>!
<ba-<>:<asp><msg "" : begin : oa-L>C<rtn>C<oa-left rtn Y = peek 177 : ba-W : if X = Y then sa-W : rtn stop : else : rpt>!

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2007, ANDREW ROUGHAN